package com.bbs.feign;

import com.bbs.dto.Archive;
import com.bbs.dto.SearchResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.websocket.server.PathParam;

/**
 * 搜索服务接口
 */
@FeignClient(value = "search-service")
public interface SearchClient {
    @PostMapping("/archives")
    void addArchive(@RequestBody Archive archive);

    @GetMapping("/archives?search={search}&pageNo={pageNo}&pageSize={pageSize}")
    SearchResult searchArchive(@PathVariable("search") String search,
                               @PathVariable("pageNo") Long pageNo,
                               @PathVariable("pageSize") Long pageSize);

    @DeleteMapping("/archives/{id}")
    void deleteArchive(@PathVariable("id") Long id);

    @DeleteMapping("/archives")
    void deleteArchiveByAppendix(@PathParam("appendix") String appendix);
}
